<template>
  <div class="feed">
    <div
      v-for="item in feed"
      :key="item.id"
      class="short-video-item"
      :style="`background-image: url('${item.video.imgUrl}');`"
      @click="
          $router.push({
            path: '/feedvideo',
            query: {
              url: item.video.url,
              img: item.user.avatarurl,
              count: item.upCount,
              title: item.shareInfo.title,
            },
          })
        "
    >
      <div class="title">
        {{ item.title }}
      </div>
      <div class="video-info">
        <img
          class="img user-avatar"
          :src="`${item.user.avatarurl}`"
          width="21.5"
          height="21.5"
        />
        <div class="user-name">{{ item.user.nickName }}</div>
        <img
          class="img like-icon"
          src="//p1.meituan.net/moviemachine/5377c2c03dacf20b6e286e3e72dd57911272.png@80q"
          width="18"
          height="18"
        />
        <div class="like-count">{{ item.upCount }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      feed: [],
    };
  },

  created: function () {
    this.axios
      .get("https://apis.netstart.cn/maoyan/video/short/0")
      .then((res) => {
        console.log(res, this, 111);
        this.feed = res.data.data.feeds;
      });
  },
};
</script>
<style lang="less">
.feed{
  margin-top: 110px;
}
.short-video-item {
  position: relative;
  display: inline-block;
  width: 49.5%;
  height: 300px;
  margin: 0 0.5% 2px 0;
  background-position: 50%;
  background-size: cover;
  .title {
    width: 170px;
    margin: 0 8px;
    position: absolute;
    color: #fff;
    font-size: 15px;
    line-height: 21px;
    bottom: 41px;
    text-shadow: 0 0 3px rgb(0 0 0 / 30%);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .video-info {
    display: flex;
    align-items: center;
    bottom: 14px;
    font-size: 13px;
    width: 170px;
    margin: 0 8px;
    position: absolute;
    color: #fff;
    .user-avatar {
      opacity: 0.9;
      border: 0 solid rgba(42, 42, 42, 0.05);
      border-radius: 10px;
    }
    .user-name {
      margin: 0 6px;
      flex: 1;
      display: inline-block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .like-icon {
      display: inline-block;
      width: 18px;
      height: 18px;
      margin-right: 3px;
      background-color: transparent;
      // background: #f5f5f5
        
    }
    .like-count {
      width: 37px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
}
</style>